package com.zdb.demo.design.pattern.structural.facade;

public class Test {
    public static void main(String[] args) {
        PointsGift pointsGift = new PointsGift();
        pointsGift.setName("乒乓球");

//        exchangeV1(pointsGift);
        PointsGiftExchangeService exchangeService = new PointsGiftExchangeService();
        String orderNo = exchangeService.exchangeGift(pointsGift);

    }

    /**
     * 此种方法导致应用程序需要和子系统打交道，不符合开闭原则
     * @param pointsGift

    public static void exchangeV1(PointsGift pointsGift) {
        QualifyService qualifyService = new QualifyService();
        PointsPaymentService pointsPaymentService = new PointsPaymentService();
        ShippingService shippingService = new ShippingService();
        if(qualifyService.isAvailable(pointsGift)) {
            if(pointsPaymentService.pay(pointsGift)) {
                String orderNo = shippingService.shipGift(pointsGift);
                System.out.println("积分礼物" + pointsGift.getName() + " 兑换成功,物流订单为：" + orderNo);
            }
        }
    }
     */

}
